<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateManagersTable extends Migration
{
    /**
     * Run the migrations.
     * 
     *
     * @return void
     */
    public function up()
    {
        Schema::create('managers', function (Blueprint $table) {
            $table->increments('id');
            $table->string('account')->comment('用户账号')->nullable();
            $table->string('name')->comment('用户名称')->nullable();
            $table->string('type')->comment('联系对象类型')->default('员工');
            $table->string('contact')->comment('联系对象')->nullable();
            $table->integer('department_id')->comment('部门分组')->default('0');
            $table->string('phone',80)->comment('移动电话')->nullable();
            $table->string('description')->comment('用户说明')->nullable();
            $table->string('img')->comment('头像')->nullable();
            $table->softDeletes();
            $table->timestamps();
            $table->unique(['account','deleted_at']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('managers');
    }
}
